'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.createTable('users', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER.UNSIGNED,
      },
      type: {
        allowNull: false,
        type: Sequelize.INTEGER.UNSIGNED,
        comment: '用户分类:0-管理员,1-普通用户',
      },
      status: {
        allowNull: false,
        type: Sequelize.INTEGER.UNSIGNED,
        defaultValue: 1,
        comment: '用户状态：0-禁用,1-正常',
      },
      sex: {
        allowNull: false,
        type: Sequelize.INTEGER.UNSIGNED,
        defaultValue: 0,
        comment: '性别：0-无,1-男,2-女',
      },
      username: {
        allowNull: false,
        type: Sequelize.STRING,
        unique: true,
        comment: '用户名',
      },
      password: {
        allowNull: false,
        type: Sequelize.STRING,
        comment: '密码',
      },
      mobile: {
        allowNull: false,
        type: Sequelize.STRING,
        defaultValue: '',
        comment: '手机号码',
      },
      email: {
        allowNull: false,
        type: Sequelize.STRING,
        defaultValue: '',
        comment: '邮箱',
      },
      avatar: {
        allowNull: false,
        type: Sequelize.STRING,
        defaultValue: '',
        comment: '头像，图片地址',
      },
      nickname: {
        allowNull: false,
        type: Sequelize.STRING,
        defaultValue: '',
        comment: '昵称',
      },
      real_name: {
        allowNull: false,
        type: Sequelize.STRING,
        defaultValue: '',
        comment: '真实姓名',
      },
      id_card: {
        allowNull: false,
        type: Sequelize.STRING,
        defaultValue: '',
        comment: '身份证号码',
      },
      description: {
        allowNull: false,
        type: Sequelize.STRING,
        defaultValue: '',
        comment: '个人描述',
      },
      label: {
        allowNull: false,
        type: Sequelize.STRING,
        defaultValue: '',
        comment: '标签，多个标签用英文,分割',
      },
      deleted_at: {
        type: Sequelize.DATE,
      },
      created_at: {
        allowNull: false,
        type: Sequelize.DATE,
      },
      updated_at: {
        allowNull: false,
        type: Sequelize.DATE,
      },
    });
  },
  async down(queryInterface, Sequelize) {
    await queryInterface.dropTable('users');
  },
};
